
from rest_framework.generics import ListAPIView
from rest_framework.viewsets import ModelViewSet
from meiduo_admin.paginators import MyPage
from meiduo_admin.serializers.group_serializers import *

# 新建分组可选权限视图
class GroupPermListView(ListAPIView):
    queryset = Permission.objects.all()
    serializer_class = GroupPermSimpleSerializer
    pagination_class = None

# 分组视图集
class GroupViewSet(ModelViewSet):
    queryset = Group.objects.all()
    serializer_class = GroupModelSerializer
    pagination_class = MyPage

    def get_queryset(self):
        return self.queryset.order_by('id')